#include "phdialogs.h"
#include "ui_phdialogs.h"
#include <QDebug>
#include <QTimer>

PhDialogs::PhDialogs(QWidget *parent) :
    QStackedWidget(parent),
    ui(new Ui::PhDialogs)
{
    ui->setupUi(this);
    connect(ui->pushButton_cancelCopySIM,SIGNAL(clicked()),this,SLOT(pushButtonCancelCopySIM_clicked()));
}

PhDialogs::~PhDialogs()
{
    qDebug()<<"Deleting dialogbox";
    delete ui;

}

void PhDialogs::setView(int view, QString text, int timeout)
{
    this->setCurrentIndex(view);
    qDebug()<<"Setting view "<<view;
    if(timeout > 0)
        QTimer::singleShot(timeout, this, SLOT(timeoutDialog()));
}

void PhDialogs::setStudentName(QString mName)
{
    ui->student_name->setText(mName);
}

void PhDialogs::timeoutDialog()
{
    emit cancle();
    this->deleteLater();
}

void PhDialogs::pushButtonCancelCopySIM_clicked()
{
    hide();
}

void PhDialogs::on_pushButton_cancelCopySIM_3_clicked()
{
    emit cancle();
    this->deleteLater();
}

void PhDialogs::on_pushButton_cancelCopySIM_4_clicked()
{
    hide();
}


void PhDialogs::on_Sim1_clicked()
{
    emit setSim(SIM1);
    hide();
}

void PhDialogs::on_Sim2_clicked()
{
    emit setSim(SIM2);
    hide();
}


void PhDialogs::on_changeSim_clicked()
{
    emit changeSIM();
}

void PhDialogs::on_pushButton_cancelCopySIM_2_clicked()
{
    emit cancle();
    this->deleteLater();
}
